import { ref, reactive } from 'vue'

export default function useHepler() {
  const formRef = ref(null)
  const forms = reactive({
    goods_type: '',
    goods_name: '',
    categorys: '',
    imagesIds: '',
    spec_type: 10,
    goods_price: 1,
    deduct_stock_type: 10
  })

  const rules = {
    goods_type: [{ required: true, message: '产品类型必填' }],
    goods_name: [{ required: true, message: '商品名称必填' }],
    categorys: [{ required: true, message: '商品分类必填' }],
    imagesIds: [{ required: true, message: '商品图片必填' }],
    goods_price: [{ required: true, message: '商品价格不能小于0' }],
    deduct_stock_type: [{ required: true, message: '库存计算方式必填' }],
  }

  return {
    formRef,
    forms,
    rules
  }
}
